<template>
  <div class="action-handler-control">
    <UserDeptSelect
      :showCompList="['dept', 'user', 'role', 'userDeptCtl']"
      v-model:ckeckList="val"
      :formCards="formCards"
    />
  </div>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue';
import UserDeptSelect from '@/components/common/UserDeptSelect/Index.vue';

export default defineComponent({
  name: 'ActionHandlerControl',
  components: {
    UserDeptSelect,
  },
  props: {
    value: {
      type: Array,
      default: () => [],
    },
    controls: {
      type: Object,
      default: () => ({}),
    },
    formCards: {
      type: Array,
      default: () => [],
    },
    controlKey: {
      type: String,
      default: () => '',
    },
  },
  setup(props, context) {
    const val = computed({
      get: () => props.value,
      set: (val) => {
        context.emit('updateValue', val, props.controlKey, props.controls);
      },
    });

    return {
      val,
    };
  },
});
</script>

<style lang="less" scoped>
.action-handler-control {
  // width: 100%;
}
</style>
